<script setup lang="ts">
import Loading3QuartersOutlined from "@ant-design/icons-vue/Loading3QuartersOutlined";
import LoadingOutlined from "@ant-design/icons-vue/LoadingOutlined";

const props = defineProps({
  loading: {
    type: Boolean,
    default: false
  },
  size: {
    type: String,
    default: 'small'
  },
  style: {
    type: Object,
    default: () => ({
      verticalAlign: 'baseline'
    })
  },
  type: {
    type: String,
    default: 'default'
  },
  ghost: {
    type: Boolean,
    default: false
  }
});
const emit = defineEmits(['refresh']);
const refresh = () => {
  emit('refresh');
}
</script>

<template>
  <a-tooltip>
    <template #title>
      点击刷新
    </template>
    <a-button :type="type" :size="size" @click="refresh" :style="style" :ghost="ghost">
      <Loading3QuartersOutlined v-if="!loading"/>
      <LoadingOutlined v-else/>
    </a-button>
  </a-tooltip>
</template>

<style scoped>

</style>
